/*
 * XML Type:  BalanceList
 * Namespace: http://ofx.net/types/2003/04
 * Java type: net.ofx.types.x2003.x04.BalanceList
 *
 * Automatically generated - do not modify.
 */
package net.ofx.types.x2003.x04.impl;
/**
 * An XML BalanceList(@http://ofx.net/types/2003/04).
 *
 * This is a complex type.
 */
public class BalanceListImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements net.ofx.types.x2003.x04.BalanceList
{
    
    public BalanceListImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName BAL$0 = 
        new javax.xml.namespace.QName("", "BAL");
    
    
    /**
     * Gets array of all "BAL" elements
     */
    public net.ofx.types.x2003.x04.Balance[] getBALArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(BAL$0, targetList);
            net.ofx.types.x2003.x04.Balance[] result = new net.ofx.types.x2003.x04.Balance[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "BAL" element
     */
    public net.ofx.types.x2003.x04.Balance getBALArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.ofx.types.x2003.x04.Balance target = null;
            target = (net.ofx.types.x2003.x04.Balance)get_store().find_element_user(BAL$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "BAL" element
     */
    public int sizeOfBALArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(BAL$0);
        }
    }
    
    /**
     * Sets array of all "BAL" element
     */
    public void setBALArray(net.ofx.types.x2003.x04.Balance[] balArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(balArray, BAL$0);
        }
    }
    
    /**
     * Sets ith "BAL" element
     */
    public void setBALArray(int i, net.ofx.types.x2003.x04.Balance bal)
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.ofx.types.x2003.x04.Balance target = null;
            target = (net.ofx.types.x2003.x04.Balance)get_store().find_element_user(BAL$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(bal);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "BAL" element
     */
    public net.ofx.types.x2003.x04.Balance insertNewBAL(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.ofx.types.x2003.x04.Balance target = null;
            target = (net.ofx.types.x2003.x04.Balance)get_store().insert_element_user(BAL$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "BAL" element
     */
    public net.ofx.types.x2003.x04.Balance addNewBAL()
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.ofx.types.x2003.x04.Balance target = null;
            target = (net.ofx.types.x2003.x04.Balance)get_store().add_element_user(BAL$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "BAL" element
     */
    public void removeBAL(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(BAL$0, i);
        }
    }
}
